﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;

namespace poco
{
    public class Name
    {
        [JsonProperty(PropertyName="formatted", NullValueHandling = NullValueHandling.Ignore)]
        public string Formatted { get; set; }

        [JsonProperty(PropertyName = "familyName", NullValueHandling = NullValueHandling.Ignore)]
        public string FamilyName { get; set; }

        [JsonProperty(PropertyName = "givenName", NullValueHandling = NullValueHandling.Ignore)]
        public string GivenName { get; set; }

        [JsonProperty(PropertyName = "middleName", NullValueHandling = NullValueHandling.Ignore)]
        public string MiddleName { get; set; }

        [JsonProperty(PropertyName = "honorificPrefix", NullValueHandling = NullValueHandling.Ignore)]
        public string HonorificPrefix { get; set; }

        [JsonProperty(PropertyName = "honorificSuffix", NullValueHandling = NullValueHandling.Ignore)]
        public string HonorificSuffix { get; set; }

        public override bool Equals(object obj)
        {
            if (obj == null) return false;
            if (obj.GetType() != this.GetType()) return false;
            Name other = (Name)obj;

            if (!Object.Equals(this.Formatted, other.Formatted)) return false;
            if (!Object.Equals(this.FamilyName, other.FamilyName)) return false;
            if (!Object.Equals(this.GivenName, other.GivenName)) return false;
            if (!Object.Equals(this.MiddleName, other.MiddleName)) return false;
            if (!Object.Equals(this.HonorificPrefix, other.HonorificPrefix)) return false;
            if (!Object.Equals(this.HonorificSuffix, other.HonorificSuffix)) return false;

            return true;
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }
}
